<!DOCTYPE html>
<html>
<head>
	<title>Angular Forms</title>
	<script src="http://apps.bdimg.com/libs/angular.js/1.4.6/angular.min.js"></script>
	<link href="http://libs.baidu.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
	<h2>AngularJS Sample Application</h2>
	<div ng-app="mainApp" ng-controller="studentController">
		<form name="studentForm" novalidate>
			<div class="row">
				<div class="col-md-3 form-label">First Name</div>
				<div class="col-md-9">
					<input class="form-control" name="firstName" type="text" ng-model="firstName" required></input>
					<span style="color: red" ng-show="studentForm.firstName.$dirty && studentForm.firstName.$invalid">
						<span ng-show="studentForm.firstName.$error.required">First Name is required.</span>
					</span>
				</div>
			</div>
			<div class="row">
				<div class="col-md-3 form-label">Last Name</div>
				<div class="col-md-9">
					<input class="form-control" name="lastName" type="text" ng-model="lastName" required></input>
					<span style="color:red" ng-show="studentForm.lastName.$dirty && studentForm.lastName.$invalid">
						<span ng-show="studentForm.lastName.$error.required">Last Name is required.</span>
					</span>
				</div>
			</div>
			<div class="row">
				<div class="col-md-3 form-label">Email</div>
				<div class="col-md-9">
					<input class="form-control" name="email" type="email" ng-model="email" length="100" required=""></input>
					<span style="color: red" ng-show="studentForm.email.$dirty && studentForm.email.$invalid">
						<span ng-show="studentForm.email.$error.required">Email is required.</span>
						<span ng-show="studentForm.email.$error.email">Invalid email address.</span>
					</span>
				</div>
			</div>
			<div class="row">
				<button ng-click="reset()" class="btn btn-default">Reset</button>
				<button class="btn btn-primary" ng-disabled="(studentForm.firstName.$dirty && studentForm.firstName.$invalid) || (studentForm.lastName.$dirty && student.lastName.$invalid) || (studentForm.email.$dirty && studentForm.email.$invalid)" ng-click="submit()">Submit</button>
			</div>
		</form>
	</div>

	<script>
		var mainApp = angular.module('mainApp', []);
		mainApp.controller('studentController', function($scope) {
			$scope.reset = function() {
				$scope.firstName = "Mahesh";
				$scope.lastName = "Parashar";
				$scope.email = "MaheshParashar@tutorialspoint.com";
			}
			$scope.reset();
		});
	</script>
</body>
</html>